<template>
    <div class="imgslide-container">
        <div class="left-btn">
            <Icon type="ios-arrow-back" color="#fff" size="60"/>
        </div>
        <div class="img-area">
            <div :class="['img-area-box',(nowId==item.id) ? 'img-area-active' : '']" v-for="(item,index) of fileList" :key="index" @click="changeNow(item.id)">
                <img class="img-area-stl" :src="item.httpurl" alt="">
                <div class="small-bg">
                   <span> 第{{index+1}}页 </span>
                </div>
            </div>
        </div>
        <div class="right-btn">
            <Icon type="ios-arrow-forward" color="#fff" size="60"/>
        </div>
    </div>
</template>

<script>
export default {
  props:['fileList'],
  data() {
    return {
        nowId:1,
    }
  },
  mounted(){
  },
  watch:{
  },
  methods: {
    changeNow(id){
        for(let item of this.fileList){
            if(id==item.id){
                this.nowId=id
                this.$store.commit("changeImg",item.httpurl);
            }
        }
    }
  }
}
</script>

<style scoped lang='scss'>
.imgslide-container{
    width:100%;
    height:70px;
    line-height: 70px;
    background-color:rgba(0, 0, 0, 0.8);
}
.left-btn{
    float:left;
    cursor: pointer;
}
.img-area{
    float: left;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}
.img-area-box{
    position: relative;
    width:80px;
    height:60px;
    border:2px solid transparent;
    margin:5px;
    box-sizing: border-box;
}
.img-area-active{
    border:2px solid #009BDB;
}
.img-area-stl{
    width:100%;
    height:100%;
}
.right-btn{
    float: right;
    cursor: pointer;
}
.small-bg{
  position:absolute;
  bottom:0;
  left:0;
  right:0;
  background-color:rgba(0, 0, 0, 0.7);
  color:#fff;
  height:30px;
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>
